<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../../vue.js"></script>
</head>

<body>
    <div id="app">
        {{message}}
        <com-a></com-a>
    </div>
    <template id="coma">
      <div>
        <h1>{{message}}</h1>
        <h2>这是coms组件{{name}}</h2>
        <button @click="changename">点击修改</button>
      </div>
    </template>
    <script>
        let ComA = {
            template: "#coma",
            data() {
                return {
                    name: "张三",
                    message: "这是组件",
                };
            },
            methods: {
                changename() {
                    this.name = "zzl";
                },
            },
        };

        new Vue({
            el: "#app",
            components: {
                ComA,
            },
            data: {
                message: "实例化",
            },
        });
    </script>
</body>

</html>